package com.example.selenium.enums;

import java.time.LocalDate;
import java.time.temporal.TemporalAdjusters;

public enum ShippingStatusEnum {
    CODE_0("0","待起运"),
    CODE_1("1","已起运"),
    CODE_2("2","已到达"),
    CODE_3("3","已回单"),
    CODE_4("4","已审核");

    private String code;
    private String desc;


    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getDesc() {
        return desc;
    }

    public void setDesc(String desc) {
        this.desc = desc;
    }

    ShippingStatusEnum(String code, String desc){
        this.code = code;
        this.desc = desc;
    }

    public static String getDescByCode(String code){
        for (int i = 0; i < ShippingStatusEnum.values().length; i++) {
            if (ShippingStatusEnum.values()[i].getCode().equals(code)) {
                return ShippingStatusEnum.values()[i].getDesc();
            }
        }
        return "";
    }

    public static void main(String[] args) {
        LocalDate localDate = LocalDate.parse("2020-"+"01"+"-01");
        LocalDate lastDay = localDate.with(TemporalAdjusters.lastDayOfMonth());
        System.out.println(lastDay.toString());
    }
}
